<template>
	<view class="my-store-info">
		<view class="plate">
			<view class="plate-li"><u--input  prefixIcon="search" placeholder="请输入设备编号" confirmType="search" border="bottom"
			 type="number" v-model="deviceNumber" clearable @confirm="searchDevice"></u--input></view>
			<view class="plate-li"><u--input placeholder="请输入设备拥有人验证码" border="bottom" type="number" v-model="smsCode"
					clearable></u--input>
				<view class="code-btn" @click="getCode">获取验证码</view>
			</view>
		</view>
		<view class="btn-pay" @click="toPay()">确认回收</view>
	</view>
</template>

<script>
	const app = getApp();
	const globalData = app.globalData;
	const apiUrl = globalData.wxApi;
	const wxImg = globalData.wxImg;
	import {
		getStoreData,
		dealNum,
		httpPost,
		httpGet,
		bdMapToTxMap,
		txMapToBdMap,
	} from "@/utils/http.js";
	import mpMixin from "@/uni_modules/uview-ui/libs/mixin/mpMixin";
	const pic1 = require(`@/img/my/my1.png`);
	export default {
		data() {
			return {
				wxImg,
				apiUrl,
				dealNum,
				pic1,
				deviceNumber: "",
				smsCode: "",
				deviceInfo:{}

			};
		},

		onShow() {

		},
		onUnload() {

		},
		onLoad(options) {},

		methods: {
			searchDevice(){
				let that = this;
				httpGet("/api/iotmerchantsdevice/deviceQuery/"+that.deviceNumber)
					.then((res) => {
						console.log(res)
						if (res.code == 0) {
							that.deviceInfo=res.data;
						}
					})
					.catch((e) => {});
			},
			toPay() {
				if (!this.deviceNumber) {
					uni.showToast({
						icon: "none",
						title: "请输入设备编号"
					});
					return
				}
				if (!this.smsCode) {
					uni.showToast({
						icon: "none",
						title: "请输入验证码"
					});
					return
				}

			},
			getCode(){
				let that = this;
				if (!this.deviceNumber) {
					uni.showToast({
						icon: "none",
						title: "请输入设备编号"
					});
					return
				}
				httpGet("/api/iotmerchantsdevice/recycleSms/"+that.deviceNumber)
					.then((res) => {
						console.log(res)
					
						if (res.code == 0) {
							
						}
					})
					.catch((e) => {});
			}


		},
	};
</script>

<style lang="scss">
	.my-store-info {
		background-color: #f5f6f6;
		height: calc(100vh - 20rpx);
		padding-top: 20rpx;
	}


	/deep/ .u-cell__title-text {
		font-size: 28rpx;
	}

	.plate {
		margin: 0 30rpx;
		background-color: #fff;
		border-radius: 10rpx;

		.plate-li {
			display: flex;
			flex-direction: row;
			justify-content: space-between;

			.code-btn {
				background-color: #ff6104;
				color: #fff;
				font-size: 24rpx;
				padding-left: 12rpx;
				padding-right: 12rpx;
				border-radius: 10rpx;
				height: 60rpx;
				line-height: 60rpx;
			}
		}
		.plate-li:nth-child(1){
			margin-bottom: 10rpx;
		}
	}

	.btn-pay {
		margin-left: 30rpx;
		margin-right: 30rpx;
		height: 70rpx;
		text-align: center;
		line-height: 70rpx;
		background-color: #ff6104;
		color: #fff;
		margin-top: 100rpx;
		border-radius: 10rpx;
	}
</style>